[UI-REWRITE]: Improve unit test coverage for React UI client to 95% and remove dead code - #5561
Conversation
1f17a60 to
2dc5529
Compare
937acee to
e137524
Compare
|
@prince3235 - can you please rebase your branch and make sure that these are your changes only? |
0f8c37e to
c36a878
Compare
marekdano
left a comment
There was a problem hiding this comment.
@prince3235 - thank you for your PR and the work on improving our unit tests!!!
Can you look at
-
The files related to coverage should not be committed.
clean_coverage.txt,clean_table.txtandcoverage_table.txt -
All lines with
{/* v8 ignore next 8 */}should be removed! -
Why do we add { timeout: 5000 } in the tests? The API response should be mocked, so no delay is expected.
Please make sure that the checks cd client && npm run format:check && npm run lint && npm run test:run && npm run e2e pass on your machine before pushing your changes to GitHub.
And please make sure that the test coverage meets 95%.
| @@ -0,0 +1,58 @@ | |||
| // vitest.config.ts | |||
There was a problem hiding this comment.
This file should not be committed. Please remove it!
| @@ -0,0 +1,740 @@ | |||
| File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | |||
There was a problem hiding this comment.
This file should not be committed. Please remove it!
| @@ -0,0 +1,740 @@ | |||
| File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | |||
There was a problem hiding this comment.
This file should not be committed. Please remove it!
| @@ -0,0 +1,202 @@ | |||
| [ | |||
There was a problem hiding this comment.
This file should not be committed. Please remove it!
| @@ -0,0 +1,202 @@ | |||
| [ | |||
There was a problem hiding this comment.
This file should not be committed. Please remove it!
| > | ||
| <TableCell className="px-4 py-3 text-sm text-foreground"> | ||
| <span className="line-clamp-1">{resource.title || resource.name}</span> | ||
| <span className="line-clamp-1">{resource.name}</span> |
There was a problem hiding this comment.
We expect no changes in the component.
| @@ -0,0 +1,56 @@ | |||
| export interface ResourceRead { | |||
There was a problem hiding this comment.
This file should not be committed. generated type files are "gitignore".
| export { SUPPORTED_LOCALES } from "./types"; | ||
| export type { SupportedLocale, LocaleMessages } from "./types"; |
| GatewayRead, | ||
| CursorPaginatedGatewaysResponse, | ||
| BodyCreateResourceV1ResourcesPost, | ||
| BodyCreateResourceResourcesPost, |
There was a problem hiding this comment.
Is there a reason to replace the type?
|
@prince3235 - Are you still interested in working on this PR? |
Signed-off-by: Prince Patel <princebpatel2005@gmail.com>
Signed-off-by: Prince Patel <princebpatel2005@gmail.com>
Signed-off-by: Prince Patel <princebpatel2005@gmail.com>
Signed-off-by: Prince Patel <princebpatel2005@gmail.com>
Signed-off-by: Prince Patel <princebpatel2005@gmail.com>
…to epic/ui-rewrite Signed-off-by: Marek Dano <Marek.Dano@ibm.com>
c36a878 to
52b15ec
Compare
…errors Signed-off-by: Marek Dano <Marek.Dano@ibm.com>
Signed-off-by: Marek Dano <Marek.Dano@ibm.com>
| - name: 🧪 Run tests with Vitest | ||
| working-directory: ./client | ||
| run: npm run test:run | ||
| run: npm run test:coverage |
There was a problem hiding this comment.
Replaced with test coverage script
| thresholds: { | ||
| statements: 95, | ||
| branches: 95, | ||
| branches: 90, |
There was a problem hiding this comment.
Branches at 90 rather than 95 because the remaining branch gap is defensive/unreachable code that isn't worth chasing.
…nd remove dead code (#5561) * test: Add comprehensive coverage for hooks and gateways components Signed-off-by: Prince Patel <princebpatel2005@gmail.com> * test: fix Resource MSW mocks and Server tests, clean dead code Signed-off-by: Prince Patel <princebpatel2005@gmail.com> * chore: remove singleFork and unused code Signed-off-by: Prince Patel <princebpatel2005@gmail.com> * style: auto-fix linting issues Signed-off-by: Prince Patel <princebpatel2005@gmail.com> * fix: resolve TypeScript errors from upstream type changes Signed-off-by: Prince Patel <princebpatel2005@gmail.com> * chore(ui-rewrite): clean up test-coverage PR per review and rebase onto epic/ui-rewrite Signed-off-by: Marek Dano <Marek.Dano@ibm.com> * test(ui-rewrite): consolidate duplicate test files and fix tsc build errors Signed-off-by: Marek Dano <Marek.Dano@ibm.com> * test(ui-rewrite): raise UI test coverage and enforce thresholds in CI Signed-off-by: Marek Dano <Marek.Dano@ibm.com> --------- Signed-off-by: Prince Patel <princebpatel2005@gmail.com> Signed-off-by: Marek Dano <Marek.Dano@ibm.com> Co-authored-by: Marek Dano <Marek.Dano@ibm.com>
Fixes #4764. Increased test coverage to >95% for UI client and removed dead code.